<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer {
            width: 300px;
            height: 300px;
            background: red;
        }

        .middle {
            width: 200px;
            height: 200px;
            background: blue;
        }

        .inner {
            width: 100px;
            height: 100px;
            background: yellow;
        }
    </style>
</head>

<body>
    <div class="outer">
        <div class="middle">
            <div class="inner"></div>
        </div>
    </div>
    <script>
        // 一、0级事件的传播
        // 0级事件 默认传播 是由小到大传播 ：事件的冒泡
        // 查看冒泡的dom结构。
        var outerEle = document.querySelector(".outer");
        var middleEle = document.querySelector(".middle");
        var innerEle = document.querySelector(".inner");
        // console.dir(outerEle);
        outerEle.onclick = function () {
            console.log("outer");
        }

        middleEle.onclick = function () {
            console.log("middle");
        }

        innerEle.onclick = function (e) {
            console.log(e.path); // 事件传播过程中所有经过的dom元素
            console.log("inner");
        }

        document.querySelector("body").onclick = function () {
            console.log("body")
        }
        document.querySelector("html").onclick = function () {
            console.log("html");
        }
        document.onclick = function () {
            console.log("document");
        }

        window.onclick = function () {
            console.log("window");
        }

    </script>
</body>

</html>